package com.huang.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.nio.charset.Charset;


@WebServlet(name = "trans", urlPatterns = {"/trans"})
public class transferServlet extends HttpServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("获取到浏览器的转账请求");
		resp.setContentType("text/html; Charset=utf-8");

		//获取会话session
//		HttpSession session = req.getSession();

		Cookie[] cookies = req.getCookies();

		if (cookies != null) {
			for (Cookie c : cookies) {
				if ("sessionId".equals(c.getName())) {
					resp.getWriter().println("i get it!");
				}
			}
		}
		resp.getWriter().println("succeed...");

	}
}
